package cn.itedus.lottery.domain.strategy.service.draw;

import cn.itedus.lottery.domain.strategy.service.algorithm.IDrawAlgorithm;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 获取所有的抽奖算法，后续可改为基于spring的策略模式
 *
 * @author 闫佳成
 * @version: 1.0
 * @since 2024/10/25 18:23
 */
public class DrawConfig {
    @Resource
    private IDrawAlgorithm entiretyRateRandomDrawAlgorithm;

    @Resource
    private IDrawAlgorithm singleRateRandomDrawAlgorithm;

    protected static Map<Integer, IDrawAlgorithm> drawAlgorithmMap = new ConcurrentHashMap<>();

    @PostConstruct
    public void init(){
        drawAlgorithmMap.put(1, singleRateRandomDrawAlgorithm);
        drawAlgorithmMap.put(2, entiretyRateRandomDrawAlgorithm);
    }
}
